/*     */ package com.umeng.analytics.a;
/*     */ 
/*     */ import com.umeng.common.Log;
/*     */ import java.util.ArrayList;
/*     */ import java.util.Collection;
/*     */ import java.util.HashMap;
/*     */ import java.util.Iterator;
/*     */ import org.json.JSONArray;
/*     */ import org.json.JSONObject;
/*     */ 
/*     */ public class i
/*     */   implements g
/*     */ {
/*  20 */   public ArrayList<g> a = new ArrayList();
/*  21 */   public ArrayList<g> b = new ArrayList();
/*     */ 
/*  23 */   public ArrayList<g> c = new ArrayList();
/*     */ 
/*  25 */   public ArrayList<g> d = new ArrayList();
/*  26 */   public ArrayList<g> e = new ArrayList();
/*     */ 
/*  28 */   private final String f = "launch";
/*  29 */   private final String g = "terminate";
/*  30 */   private final String h = "error";
/*  31 */   private final String i = "event";
/*  32 */   private final String j = "ekv";
/*     */ 
/*     */   public void a(h paramh)
/*     */   {
/*  38 */     if ((paramh != null) && (paramh.a()))
/*  39 */       this.a.add(paramh);
/*     */   }
/*     */ 
/*     */   public void a(m paramm)
/*     */   {
/*  44 */     if ((paramm != null) && (paramm.a()))
/*  45 */       this.b.add(paramm);
/*     */   }
/*     */ 
/*     */   public void a(d paramd)
/*     */   {
/*  50 */     if ((paramd != null) && (paramd.a()))
/*  51 */       this.c.add(paramd);
/*     */   }
/*     */ 
/*     */   public void a(e parame)
/*     */   {
/*  56 */     if ((parame != null) && (parame.a()))
/*  57 */       this.d.add(parame);
/*     */   }
/*     */ 
/*     */   public void a(String paramString, a parama)
/*     */   {
/*  62 */     if ((parama != null) && (parama.a())) {
/*  63 */       for (g localg : this.e) {
/*  64 */         b localb = (b)localg;
/*     */ 
/*  66 */         if (localb.a.equals(paramString)) {
/*  67 */           localb.b.add(parama);
/*  68 */           return;
/*     */         }
/*     */       }
/*     */ 
/*  72 */       this.e.add(new b(paramString, parama));
/*     */     }
/*     */   }
/*     */ 
/*     */   public void a(b paramb) {
/*  77 */     if ((paramb != null) && (paramb.a()))
/*  78 */       this.e.add(paramb);
/*     */   }
/*     */ 
/*     */   private void c(JSONObject paramJSONObject) throws Exception
/*     */   {
/*  83 */     if (paramJSONObject.has("launch")) {
/*  84 */       JSONArray localJSONArray = paramJSONObject.getJSONArray("launch");
/*     */ 
/*  86 */       for (int k = 0; k < localJSONArray.length(); k++) {
/*  87 */         h localh = new h();
/*     */ 
/*  89 */         localh.a(localJSONArray.getJSONObject(k));
/*     */ 
/*  91 */         a(localh);
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   private void d(JSONObject paramJSONObject) throws Exception {
/*  97 */     if (paramJSONObject.has("terminate")) {
/*  98 */       JSONArray localJSONArray = paramJSONObject.getJSONArray("terminate");
/*     */ 
/* 100 */       for (int k = 0; k < localJSONArray.length(); k++) {
/* 101 */         m localm = new m();
/*     */ 
/* 103 */         localm.a(localJSONArray.getJSONObject(k));
/*     */ 
/* 105 */         a(localm);
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   private void e(JSONObject paramJSONObject) throws Exception {
/* 111 */     if (paramJSONObject.has("event")) {
/* 112 */       JSONArray localJSONArray = paramJSONObject.getJSONArray("event");
/*     */ 
/* 114 */       for (int k = 0; k < localJSONArray.length(); k++) {
/* 115 */         e locale = new e();
/*     */ 
/* 117 */         locale.a(localJSONArray.getJSONObject(k));
/*     */ 
/* 119 */         a(locale);
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   private void f(JSONObject paramJSONObject) throws Exception {
/* 125 */     if (paramJSONObject.has("ekv")) {
/* 126 */       JSONArray localJSONArray = paramJSONObject.getJSONArray("ekv");
/*     */ 
/* 128 */       for (int k = 0; k < localJSONArray.length(); k++) {
/* 129 */         b localb = new b();
/*     */ 
/* 131 */         localb.a(localJSONArray.getJSONObject(k));
/*     */ 
/* 133 */         a(localb);
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   private void g(JSONObject paramJSONObject) throws Exception {
/* 139 */     if (paramJSONObject.has("error")) {
/* 140 */       JSONArray localJSONArray = paramJSONObject.getJSONArray("error");
/*     */ 
/* 142 */       for (int k = 0; k < localJSONArray.length(); k++) {
/* 143 */         d locald = new d();
/*     */ 
/* 145 */         locald.a(localJSONArray.getJSONObject(k));
/*     */ 
/* 147 */         a(locald);
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   public void a(JSONObject paramJSONObject) {
/*     */     try {
/* 154 */       if (paramJSONObject == null) {
/* 155 */         return;
/*     */       }
/*     */ 
/* 158 */       c(paramJSONObject);
/* 159 */       d(paramJSONObject);
/* 160 */       e(paramJSONObject);
/* 161 */       f(paramJSONObject);
/* 162 */       g(paramJSONObject);
/*     */     }
/*     */     catch (Exception localException) {
/* 165 */       Log.b("MobclickAgent", "merge log body eror", localException);
/*     */     }
/*     */   }
/*     */ 
/*     */   private JSONArray a(ArrayList<g> paramArrayList) {
/* 170 */     JSONArray localJSONArray = null;
/*     */ 
/* 172 */     if (paramArrayList.size() > 0) {
/* 173 */       localJSONArray = new JSONArray();
/* 174 */       j localj = null;
/*     */ 
/* 176 */       for (g localg : paramArrayList) {
/*     */         try {
/* 178 */           localj = new j(this, localg);
/*     */         }
/*     */         catch (Exception localException)
/*     */         {
/* 184 */           Log.a("MobclickAgent", "Fail to write json ...", localException);
/*     */         }
/*     */ 
/* 187 */         if (localj != null)
/*     */         {
/* 189 */           localJSONArray.put(localj);
/*     */         }
/*     */       }
/*     */     }
/* 193 */     if ((localJSONArray == null) || (localJSONArray.length() == 0)) return null;
/*     */ 
/* 195 */     return localJSONArray;
/*     */   }
/*     */ 
/*     */   public void b(JSONObject paramJSONObject)
/*     */     throws Exception
/*     */   {
/* 202 */     JSONArray localJSONArray1 = a(this.a);
/* 203 */     JSONArray localJSONArray2 = a(this.b);
/* 204 */     JSONArray localJSONArray3 = a(this.d);
/* 205 */     JSONArray localJSONArray4 = a(this.c);
/* 206 */     JSONArray localJSONArray5 = a(this.e);
/*     */ 
/* 208 */     if (localJSONArray1 != null) paramJSONObject.put("launch", localJSONArray1);
/* 209 */     if (localJSONArray2 != null) paramJSONObject.put("terminate", localJSONArray2);
/* 210 */     if (localJSONArray3 != null) paramJSONObject.put("event", localJSONArray3);
/* 211 */     if (localJSONArray4 != null) paramJSONObject.put("error", localJSONArray4);
/* 212 */     if (localJSONArray5 != null) paramJSONObject.put("ekv", localJSONArray5);
/*     */   }
/*     */ 
/*     */   public boolean a()
/*     */   {
/* 219 */     g localg;
/* 219 */     for (Iterator localIterator = this.a.iterator(); localIterator.hasNext(); ) { localg = (g)localIterator.next();
/* 220 */       if (!localg.a()) return false;
/*     */     }
/* 222 */     for (localIterator = this.b.iterator(); localIterator.hasNext(); ) { localg = (g)localIterator.next();
/* 223 */       if (!localg.a()) return false;
/*     */     }
/* 225 */     for (localIterator = this.d.iterator(); localIterator.hasNext(); ) { localg = (g)localIterator.next();
/* 226 */       if (!localg.a()) return false;
/*     */     }
/* 228 */     for (localIterator = this.e.iterator(); localIterator.hasNext(); ) { localg = (g)localIterator.next();
/* 229 */       if (!localg.a()) return false;
/*     */     }
/*     */ 
/* 232 */     for (localIterator = this.c.iterator(); localIterator.hasNext(); ) { localg = (g)localIterator.next();
/* 233 */       if (!localg.a()) return false;
/*     */     }
/*     */ 
/* 236 */     if ((this.a.size() == 0) && (this.b.size() == 0) && (this.d.size() == 0) && (this.e.size() == 0) && (this.c.size() == 0)) {
/* 237 */       return false;
/*     */     }
/* 239 */     return true;
/*     */   }
/*     */ 
/*     */   public void a(i parami) {
/* 243 */     this.a.addAll(parami.a);
/* 244 */     this.b.addAll(parami.b);
/*     */ 
/* 246 */     this.d.addAll(parami.d);
/* 247 */     this.c.addAll(parami.c);
/*     */ 
/* 249 */     b(parami.e);
/*     */   }
/*     */ 
/*     */   private void b(ArrayList<g> paramArrayList)
/*     */   {
/* 257 */     if (paramArrayList.isEmpty()) return;
/*     */ 
/* 259 */     HashMap localHashMap = new HashMap();
/*     */     Object localObject;
/*     */     b localb;
/* 262 */     for (Iterator localIterator = paramArrayList.iterator(); localIterator.hasNext(); ) { localObject = (g)localIterator.next();
/*     */ 
/* 264 */       localb = (b)localObject;
/* 265 */       if (localHashMap.containsKey(localb.a))
/* 266 */         ((b)localHashMap.get(localb.a)).a(localb);
/*     */       else {
/* 268 */         localHashMap.put(localb.a, localb);
/*     */       }
/*     */     }
/*     */ 
/* 272 */     for (localIterator = this.e.iterator(); localIterator.hasNext(); ) { localObject = (g)localIterator.next();
/* 273 */       localb = (b)localObject;
/* 274 */       if (localHashMap.containsKey(localb.a))
/* 275 */         ((b)localHashMap.get(localb.a)).a(localb);
/*     */       else {
/* 277 */         localHashMap.put(localb.a, localb);
/*     */       }
/*     */ 
/*     */     }
/*     */ 
/* 282 */     this.e.clear();
/*     */ 
/* 284 */     for (localIterator = localHashMap.values().iterator(); localIterator.hasNext(); ) { localObject = (b)localIterator.next();
/* 285 */       this.e.add(localObject); }
/*     */   }
/*     */ 
/*     */   public int b()
/*     */   {
/* 290 */     int k = 0;
/* 291 */     for (g localg : this.e) {
/* 292 */       b localb = (b)localg;
/* 293 */       k += localb.b.size();
/*     */     }
/*     */ 
/* 296 */     k += this.a.size();
/* 297 */     k += this.b.size();
/* 298 */     k += this.d.size();
/* 299 */     k += this.c.size();
/*     */ 
/* 301 */     return k;
/*     */   }
/*     */ 
/*     */   public void c() {
/* 305 */     this.a.clear();
/* 306 */     this.b.clear();
/*     */ 
/* 308 */     this.d.clear();
/* 309 */     this.e.clear();
/*     */ 
/* 311 */     this.c.clear();
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\umeng_sdk.jar
 * Qualified Name:     com.umeng.analytics.a.i
 * JD-Core Version:    0.6.2
 */